<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>显示笔记</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        h2 {
            color: #333;
            text-align: center;
        }
        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        th, td {
            padding: 10px;
            text-align: left;
            border-bottom: 1px solid #ddd;
        }
        th {
            background-color: #f2f2f2;
            font-weight: bold;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        a {
            color: #007BFF;
            text-decoration: none;
            transition: color 0.3s ease;
        }
        a:hover {
            color: #0056b3;
            text-decoration: underline;
        }
        /* 响应式设计 */
        @media (max-width: 768px) {
            body {
                margin: 10px;
            }
            table {
                overflow-x: auto;
            }
            th, td {
                padding: 8px;
            }
        }
    </style>
</head>
<body>
<h2>{{uname}}的笔记<a href="/note/add">添加笔记</a></h2>
<table>
    <thead>
        <tr>
            <th>ID</th>
            <th>标题</th>
            <th>创建时间</th>
            <th>修改时间</th>
            <th>修改</th>
            <th>删除</th>
        </tr>
    </thead>
    <tbody>
        {% for item in page.object_list %}
        <tr>
            <td>{{item.id}}</td>
            <td>
                <a href="/note/mod/{{item.id}}">
                {{item.title}}
                </a>
            </td>
            <td>{{item.created_time}}</td>
            <td>{{item.updated_time}}</td>
            <td>
                <a href="/note/mod/{{item.id}}">修改</a>
            </td>
            <td>
                <a href="/note/del/{{item.id}}">删除</a>
            </td>
        </tr>
        {% empty%}
        <tr>
            <td colspan="6">
                用户什么都没写,去<a href="/note/add">写笔记</a>
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% if page.has_previous %}
<a href="/note/?page_num={{page.previous_page_number}}">上一页</a>
{% else %}
上一页
{% endif %}
{% for page_num in paginator.page_range %}
    {% if page.number == page_num %}
        {{page_num}}
    {% else %}
        <a href="/note/?page_num={{page_num}}">{{page_num}}</a>
    {% endif %}
{% endfor %}
{% if page.has_next %}
    <a href="/note/?page_num={{page.next_page_number}}">下一页</a>
{% else %}
下一页
{% endif %}
</body>
</html>
